package org.geeks.jredisbloom.service;

import io.rebloom.client.Client;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class BookService {

    @Autowired
    private Client client;

    private final String bookBloomKey = "JRedisBloom:book";

    public Boolean check(String id) {
        return client.exists(bookBloomKey, id);
    }

    public void add(String id) {
        client.add(bookBloomKey, id);
    }

    public void clear() {
        client.delete(bookBloomKey);
    }
}
